New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@allmaps/annotation

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allmaps/annotation

Functions for generating and parsing IIIF georeference annotations

  • 1.0.0-beta.30
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@allmaps/annotation

@allmaps/annotation is a JavaScript module that can generate and parse Georeference Annotations.

A Georeference Annotation is a Web Annotation that stores the metadata needed to georeference a IIIF image.

A Georeference Annotation contains the following data:

  • The URI of an IIIF Image, as well as its dimensions in pixels.
  • A list of ground control points (GCPs) that define the mapping between resource coordinates and geospatial coordinates.
  • A polygonal resource mask that defines the cartographic part of the image.

Georeference Annotations are a core part of Allmaps. For example, Allmaps Viewer can warp maps IIIF maps in the browser, just by loading a georeference annotation.

Installation & usage

This is an ESM-only module that works in browsers and Node.js.

Node.js:

First, run npm install @allmaps/annotation to add this module to your project.

import { parseAnnotation, generateAnnotation } from '@allmaps/annotation'

Browser:

<script type="module">
  import {
    parseAnnotation,
    generateAnnotation
  } from 'https://unpkg.com/@allmaps/annotation?module'
</script>

API

Table of Contents

Generating & parsing Georeference Annotations

parseAnnotation

Parses a Georeference Annotation or an AnnotationPage containing multiple Georeference Annotations and returns an array of maps.

Parameters
  • annotation (Annotation | AnnotationPage) Georeference Annotation or AnnotationPage containing multiple Georeference Annotations
Examples
import fs from 'fs'
import { parseAnnotation } from '@allmaps/annotation'

const annotation = JSON.parse(fs.readFileSync('./examples/annotation.example.json'))
const maps = parseAnnotation(annotation)

Returns Array<Map> Array of maps

generateAnnotation

Generates a Georeference Annotation from a single map or an AnnotationPage containing multiple Georeference Annotations from an array of maps.

Parameters
  • mapOrMaps (Map | Array<Map>) Single map object, or array of maps
Examples
import fs from 'fs'
import { generateAnnotation } from '@allmaps/annotation'

const map = JSON.parse(fs.readFileSync('./examples/map.example.json'))
const annotation = generateAnnotation(map)

Returns (Annotation | AnnotationPage) Georeference Annotation

Types

The two types this module converts between, Annotation, AnnotationPage and Map, are described below.

Map

Object that contains the data needed to georeference a IIIF resource in the format that is used by Allmaps internally.

Type: Object

Annotation

Web Annotation that contains a single Georeference Annotation.

Type: Object

AnnotationPage

An Annotation Page that contains multiple Georeference Annotations.

Type: Object

Keywords

FAQs

Package last updated on 31 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc